package com.thinkgem.jeesite.common.frame.rpc.bean;

/**
 * Created by liufeng on 2016/6/6.
 */
public class RPCHeader {

    /**
     * 签名
     */
    private String sign;
    /**
     * 时间戳
     */
    private String time;

    /**
     * 范围 client或public
     */
    private String scope;
    /**
     * 系统 前台或后台
     */
    private String sys;
    /**
     * 模块名
     */
    private String module;
    /**
     * 方法名
     */
    private String method;


    public String getSign() {
        return sign;
    }

    public String getTime() {
        return time;
    }

    public String getScope() {
        return scope;
    }

    public String getSys() {
        return sys;
    }

    public String getModule() {
        return module;
    }

    public String getMethod() {
        return method;
    }

    public RPCHeader(RPCHeaderBuilder builder) {

        this.sign = builder.sign;
        this.time = builder.time;
        this.method = builder.method;
        this.sys = builder.sys;
        this.scope = builder.scope;
        this.module = builder.module;
    }

    public static class RPCHeaderBuilder {

        private String sign;
        private String time;
        private String scope;
        private String sys;
        private String module;
        private String method;

        public RPCHeaderBuilder addSign(String sign) {
            this.sign = sign;
            return this;
        }

        public RPCHeaderBuilder addTime(String time) {
            this.time = time;
            return this;
        }


        public RPCHeaderBuilder addScope(String scope) {
            this.scope = scope;
            return this;
        }

        public RPCHeaderBuilder addSys(String sys) {
            this.sys = sys;
            return this;
        }

        public RPCHeaderBuilder addModule(String module) {
            this.module = module;
            return this;
        }

        public RPCHeaderBuilder addMethod(String method) {
            this.method = method;
            return this;
        }


        public RPCHeader builder() {
            return new RPCHeader(this);
        }

    }

    @Override
    public String toString() {
        return "RPCHeader{" +
                "sign='" + sign + '\'' +
                ", time='" + time + '\'' +
                ", scope='" + scope + '\'' +
                ", sys='" + sys + '\'' +
                ", module='" + module + '\'' +
                ", method='" + method + '\'' +
                '}';
    }
}
